package com.study.hot.jetpack.livedata

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import com.study.hot.R
import com.study.hot.databinding.ActivityDataBindingLivedataBinding

/**
 * <pre>
 *     author : fauks
 *     time   : 2020/03/24
 *     desc   :
 * </pre>
 */
class DataBindingLiveDataActivity : AppCompatActivity() {

    lateinit var dataBindingBinding: ActivityDataBindingLivedataBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        dataBindingBinding = DataBindingUtil.setContentView(this, R.layout.activity_data_binding_livedata)
        val customLiveData = ViewModelProvider(this)[CustomLiveData::class.java]
        dataBindingBinding.data = customLiveData
        dataBindingBinding.lifecycleOwner = this
    }
}